import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

class SelectableContainer extends StatelessWidget {
  final bool isSelected;
  final Function() toggleSelection;
  final Widget child;
  const SelectableContainer({
    super.key,
    required this.child,
    required this.isSelected,
    required this.toggleSelection,
  });

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: toggleSelection,
      child: Stack(
        children: [
          Container(
            decoration:BoxDecoration(
              borderRadius: BorderRadius.circular(8.r),
              border: isSelected? Border.all(
                      color: const Color.fromRGBO(252, 207, 1, 1),
                      width: 1.0,
                    ):Border.all(
                      color: Colors.transparent,
                      width: 1.0,
                    ),
            ),
            child: child,
          ),
          if (isSelected)
            Positioned(
              right: 0,
              bottom: 0,
              child: Image.asset(
                'assets/images/Group 1321318595@2x (1).png',
                width: 26.w,
                height: 22.h,
              ),
            ),
        ],
      ),
    );
  }
}
